<!--
* description: 渠道小类弹出框
* author: xgzh
* createdDate: 2019-10-30
-->
<template>
  <section class="carTypeConfig">
    <el-dialog
      v-dialogDrag
      title="渠道小类"
      :visible.sync="curPopupsVisible"
      width="1000px"
      center
      @close="sendCode"
      :close-on-click-modal="false"
      :append-to-body="true"
    >
      <dialogHeader slot="title" :title="'渠道小类'" :styleType="$store.state.app.dialogType"></dialogHeader>
      <one-table-template
        ref="multipleTable"
        :dynamicButtons="tableButtons"
        :dynamicComponents="tableComponents"
        :dynamicApiConfig="apiConfig"
        :dynamicTableCols="tableCols"
        :dynamicFormFields="formField"
        :dynamicIsShowSelect="isMul"
      />
    </el-dialog>
  </section>
</template>
<script>
import { oneTableWithViewTemplateMixins } from "@/components/mixins/oneTableWithViewTemplateMixins";
import { valueObjectMixins } from "@/components/mixins/valueObjectMixins";
import { crmApis } from "@/api/apiList/crm";
import OneTableTemplate from "@/components/crm/commonComponents/crmPopupsOneTable";
export default {
  // 组件混入对象：{data[listQuery] methods[queryTable]}
  mixins: [oneTableWithViewTemplateMixins, valueObjectMixins],
  components: {
    OneTableTemplate,
    dialogHeader: () => import("@/components/dialogHeader") //弹窗标题
  },
  // props:{
  //   valueObject:{type:Object,default:{}}
  // },
  data() {
    return {
      // 网格查询API配置对象
      apiConfig: crmApis.pcDbInfoChanDQueryFind,
      // 动态组件-按钮
      tableButtons: [
        {
          compKey: "btnKey1",
          type: "primary",
          size: "small",
          clickEvent: () => this.query(),
          text: "查询",
          position: "top"
        },
        {
          compKey: "btnKey2",
          type: "primary",
          size: "small",
          clickEvent: () => this.sendCode("infoChanDCode", "infoChanDName"),
          text: "确认",
          position: "bottom"
        }
      ],
      // 动态组件-查询条件
      tableComponents: [
        {
          compKey: "compKey1",
          labelName: "渠道大类",
          disabled: true,
          codeField: "name",
          component: () => import("@/components/org/commonInput"),
          type: "inputText",
          isMust: true
        }
      ],
      // 动态生成网格列
      tableCols: [
        // {
        //   prop: "controlBtn",
        //   label: "选择",
        //   width: 60,
        //   align: "center",
        //   codeField: "controlBtn",
        //   isComponent: true,
        //   comps: [
        //     {
        //       compKey: "propKey1",
        //       labelName: "选择",
        //       codeField: "editControlBtn",
        //       align: "center",
        //       isShowLabel: true,
        //       isShow: true,
        //       clickEvent: index => this.edit(index),
        //       // clickEvent: this.edit,
        //       component: () => import("@/components/org/linkButton")
        //     }
        //   ]
        // },
        {
          prop: "cantactWayName",
          label: "接触方式名称",
          width: null,
          align: "center"
        },
        {
          prop: "infoChanMName",
          label: "渠道大类名称",
          width: null,
          align: "center"
        },
        {
          prop: "infoChanDName",
          label: "渠道小类名称",
          width: null,
          align: "center"
        },
        {
          prop: "infoChanDCode",
          label: "渠道小类编码",
          hidden: true,
          width: null,
          align: "center"
        }
      ],
      //表单查询数据（查询条件）
      formField: {
        infoChanDName: "",
        infoChanDCode: "",
        infoChanMCode: "",
        isPv: "1",
        oemCode: this.$store.getters.orgInfo.OEM_CODE,
        groupCode: this.$store.getters.orgInfo.GROUP_CODE,
        name: ""
      },
      unFormField: {
        name: ""
      },
      handleTableRowData: {
        value: "infoChanDCode",
        text: "infoChanDName"
      }
    };
  },
  methods: {
    query() {
      let that = this;
      this.$refs.multipleTable.unFormField = that.unFormField;
      this.$refs.multipleTable.queryTable(1);
    }
  }
};
</script>
















